var t = n(require("./utils/index")), e = n(require("./libs/x/index")), a = n(require("./store/index")), o = require("./api/custom");

function n(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var i = require("./libs/w7/index.js"), s = require("./siteinfo");

App({
    onLaunch: function(e) {
        var a, n = e.mode, i = s.siteroot, d = s.m || s.module || "one_wifi", r = /https?:\/\/[a-z0-9.-]+\//gi.exec(i)[0], u = r + "addons/" + d;
        this.globalData.origin = r, this.globalData.moduleHost = u, "singlePage" !== (this.globalData.mode = n) ? (wx.startWifi(), 
        t.default.wxLogin().then(function() {
            (0, o.getCustomDetail)();
        }).catch(function(e) {
            console.error("ERROR: ", e), t.default.modalText(e.errMsg || e.message || "服务器出错，登陆失败").then(function() {
                wx.reLaunch({
                    url: "/pages/error/index"
                });
            });
        }), e = (a = wx.getSystemInfoSync()).statusBarHeight, i = a.platform, d = a.windowHeight, 
        r = a.screenWidth, u = a.screenHeight, a = (n = wx.getMenuButtonBoundingClientRect()).top, 
        n = n.height, wx.setStorage({
            key: "platform",
            data: i
        }), wx.setStorageSync("screenWidth", r), wx.setStorageSync("screenHeight", u), wx.setStorageSync("windowHeight", d), 
        wx.setStorageSync("platform", i), wx.setStorageSync("statusBarHeight", e), wx.setStorageSync("menuButtonHeight", n || 32), 
        a && 0 !== a && n && 0 !== n ? (n = 2 * (a - e) + n, wx.setStorageSync("navigationBarHeight", n)) : wx.setStorageSync("navigationBarHeight", "android" === i ? 48 : 40)) : (0, 
        o.getCustomDetail)();
    },
    onShow: function() {
        this.autoUpdate(), this.cuttofCopy();
    },
    cuttofCopy: function() {
        a.default.data.custom && 1 == +a.default.data.custom.dam_active && wx.setClipboardData({
            data: "" + a.default.data.custom.dam_content,
            complete: function() {
                wx.hideLoading(), wx.hideToast();
            }
        });
    },
    autoUpdate: function() {
        var t, e = this;
        wx.canIUse("getUpdateManager") && "singlePage" !== this.globalData.mode && (t = wx.getUpdateManager()).onCheckForUpdate(function(a) {
            a.hasUpdate && wx.showModal({
                title: "更新提示",
                content: "检测到新版本，是否下载新版本并重启小程序？",
                success: function(a) {
                    a.confirm ? e.downLoadAndUpdate(t) : a.cancel && wx.showModal({
                        content: "本次版本更新涉及到新的功能添加，旧版本可能无法正常访问的哦~",
                        showCancel: !1,
                        confirmText: "确定更新",
                        success: function() {
                            e.downLoadAndUpdate(t);
                        }
                    });
                }
            });
        });
    },
    downLoadAndUpdate: function(t) {
        wx.showLoading(), t.onUpdateReady(function() {
            wx.hideLoading(), t.applyUpdate();
        }), t.onUpdateFailed(function() {
            wx.showModal({
                title: "已经有新版本了哟~",
                content: "新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~"
            });
        });
    },
    w7: i,
    x: e.default,
    utils: t.default,
    store: a.default,
    siteInfo: require("siteinfo.js"),
    globalData: {
        origin: "",
        moduleHost: "",
        groupList: []
    }
});